<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%-- 修改到货信息 --%>
<!DOCTYPE HTML>
<html>
<head>
<base href="<%=basePath%>">

<title>修改到货信息</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<%-- 引用layui.css --%>
<link rel="stylesheet" type="text/css" href="js/layui/css/layui.css" />
</head>

<body>
	<div id="userUpd">
		<form class="layui-form" action="" style="margin:40px;">
			<input name="user_id" type="hidden" value="" />
			<div class="layui-form-item">
				<label class="layui-form-label"></span>商品ID</label>
				<div class="layui-input-block">
					<input type="text" name="purchaseGoodsId" required lay-verify="id"
						autocomplete="off" class="layui-input" onfocus=this.blur()>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"></span>采购单号</label>
				<div class="layui-input-block">
					<input type="text" name="purchaseId" required lay-verify="purchaseId"
						 autocomplete="off" class="layui-input" onfocus=this.blur()>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"></span>商品名称</label>
				<div class="layui-input-block">
					<input type="text" name="goodsName" required lay-verify="goodsName"
						 autocomplete="off" class="layui-input" onfocus=this.blur()>
				</div>
			</div>
			
			<div class="layui-form-item">
				<label class="layui-form-label"></span>所属服务点</label>
				<div class="layui-input-block">
					<input type="text" name="areaName" maxlength="10"
					 autocomplete="off" class="layui-input" onfocus=this.blur()>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">商品类型</label>
				<div class="layui-input-block">
					<c:if test="${type ==0}">
						<input type="hidden" name="goodsType"  value="0"  maxlength="50"
							 autocomplete="off" class="layui-input" onfocus=this.blur()>
						<input type="text" name="type"  value="正品"  maxlength="50"
							 autocomplete="off" class="layui-input" onfocus=this.blur()>
					</c:if>
					<c:if test="${type ==1}">
						<input type="hidden" name="goodsType"  value="1"  maxlength="50"
							 autocomplete="off" class="layui-input" onfocus=this.blur()>
						<input type="text" name="type"  value="打折"  maxlength="50"
							 autocomplete="off" class="layui-input" onfocus=this.blur()>
					</c:if>
					<c:if test="${type ==2}">
						<input type="hidden" name="goodsType"  value="2"class="layui-input"
						 onfocus=this.blur()>
						<input type="text" name="type"  value="体验"  maxlength="50"
							 autocomplete="off" class="layui-input" onfocus=this.blur()>
					</c:if>
					<c:if test="${type ==3}">
						<input type="hidden" name="goodsType"  value="3"class="layui-input"
						 onfocus=this.blur()>
						<input type="text" name="type"  value="积分对象"  maxlength="50"
							 autocomplete="off" class="layui-input" onfocus=this.blur()>
					</c:if>
					<c:if test="${type ==4}">
						<input type="hidden" name="goodsType"  value="4"class="layui-input"
						 onfocus=this.blur()>
						<input type="text" name="type"  value="打包"  maxlength="50"
							 autocomplete="off" class="layui-input" onfocus=this.blur()>
					</c:if>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"></span>采购数量</label>
				<div class="layui-input-block">
					<input type="text" name="number" 
					 autocomplete="off" class="layui-input" onfocus=this.blur()>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"></span>实际到货数量</label>
				<div class="layui-input-block">
					<input type="hidden" name="num" class="layui-input">
					<input type="text" name="realNum" maxlength="10"
					 placeholder="请输入实际到货数量" autocomplete="off" class="layui-input">
				</div>
			</div>
			<hr class="layui-bg-gray">
			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn" lay-submit lay-filter="confirm">确认</button>
					<button  id="closeBtn" class="layui-btn layui-btn-primary">取消</button>
				</div>
			</div>
		</form>
	</div>
	<script type="text/javascript" src="js/layui/layui.js"></script>
	<script type="text/javascript">
	layui.config({
        base: "<%=basePath%>/js/common/"
    }).use(["common", "element", "layer", "form", "table", "jquery"], function(){
			var elem = layui.element;
			var layer = layui.layer;
			var form = layui.form;
			var table = layui.table;
			var $ = layui.jquery;
			layui.common.init();
			//监听提交  添加
            form.on('submit(confirm)', function(data){
                // layer.msg(JSON.stringify(data.field));
                console.log(data.field);
                $.ajax({
                    type:"post",
                    url:'CGDH/updTvp.do',
                    data:data.field,
                    dataType:"json",
                    success:function(json){
                       
                        if(json.statusCode == 200){
                        	var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                            parent.layer.msg(json.message, {icon: 6,time: 2000});
                        } else{
                        	layer.msg(json.message, {icon: 5,time: 2000});
                        }
                    }
                });
                return false;
            });
			
			//关闭当前弹出层
            $(document).on('click', '#closeBtn',
                    function() {
                        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        parent.location.reload();//刷新父页面，注意一定要在关闭当前iframe层之前执行刷新
                        parent.layer.close(index); //再执行关闭
                    });
    
    });


	</script>
</body>
</html>
